<% layout('/layouts/default.html', {title: '任务部署信息表(主)管理', libs: ['dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<#form:form id="searchForm" model="${dcSupTaskInfo}" action="${ctx}/taskdeploy/dcSupTaskInfoSecretary/findListData?taskStatus=2&normalFlag=2" method="post" class="form-inline"
			data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
			<div style="float: right">
					<#form:hidden path="messageNumber"/>
					<#form:hidden path="taskYear"/>
					<#form:hidden path="taskTitle"/>
					<#form:hidden path="taskTypeCode"/>
				    <#form:hidden path="searchType"/>
				<div class="form-group">
					<label class="control-label">${text('任务内容')}：</label>
					<div class="control-inline width-160">
						<#form:input path="taskContent" maxlength="200" class="form-control width-160" placeholder="请输入任务内容"/>
					</div>
				</div>
				<div class="form-group" >
					<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
					<button onclick="cz();" class="btn btn-default btn-sm">${text('重置')}</button>
				</div>
			</div>
		</#form:form>
	</div>
	<div class="box-body">
		<table id="dataGrid"></table>
		<div id="dataGridPage"></div>
	</div>
</div>
</div>
<% } %>
<script>
	//重置
	function cz(){
		searchForm.reset();
		$('#dataGrid').dataGrid('reloadGrid');
	}

	// 初始化DataGrid对象
	$('#dataGrid').dataGrid({
		searchForm: $("#searchForm"),
		sortableColumn: false, // 列表不允许排序
		columnModel: [
			{header:'${text("主键")}', name:'id', index:'a.id', width:150, align:"left", hidden:true},
			{header:'${text("督办字号")}', name:'messageNumber', index:'a.message_number', width:100, align:"left"},
			{header:'${text("任务标题")}', name:'taskTitle', index:'a.task_title', width:150, align:"left"
				, formatter: function(val, obj, row, act){
					var messageNumber =encodeURIComponent(row.messageNumber);
					var taskTitle =encodeURIComponent(row.taskTitle);
					return '<a href="${ctx}/taskdeploy/dcSupTaskInfoSecretary/titleListed?remarks1=1&taskId='+row.id+'&messageNumber='+messageNumber+'&taskYear='+row.taskYear+'&taskTitle='+taskTitle+'&taskTypeCode='+row.taskTypeCode+'" class="btnList" data-title="${text("牵头责任单位详情")}">'+(val||'暂无标题')+'</a>';
				}
			},
			{header:'${text("任务类型")}', name:'taskTypeName', index:'a.task_type_name', width:150, align:"left"},
			{header:'${text("任务内容")}', name:'taskContent', index:'a.task_content', width:150, align:"left"
				, formatter: function(val, obj, row, act){
					return '<a href="${ctx}/taskdeploy/dcSupTaskInfo/detailForm?id='+row.id+'" class="btnList" data-title="${text("督办任务信息")}">'+(val||'暂无内容')+'</a>';
				}
			},
			{header:'${text("排序编号")}', name:'sortNum', index:'a.sort_num', width:50, align:"left"},
			{header:'${text("任务状态")}', name:'taskStatus', index:'a.task_status', width:150, align:"center"
				,formatter: function(val, obj, row, act){
					return js.getDictLabel(${@DictUtils.getDictListJson('dc_task_status')}, val, '${text("未知")}', true);
				}},
			// {header:'${text("操作")}', name:'actions', align:"center",width:250, formatter: function(val, obj, row, act){
			// 		var actions = [];
			// 	<% if(hasPermi('taskdeploy:dcSupTaskInfo:edit')){ %>
			// 			if((row.taskStatus=='1'||row.taskStatus=='4'||row.taskStatus=='6') && ('${@UserUtils.getUser().getUserCode()}' == 'system'||row.createBy == '${@UserUtils.getUser().getUserCode()}')){
			// 				actions.push('<a href="#" class="btn btn-primary btn-xs " onclick=editTask("'+row.id+'") title="${text("编辑督办事项")}">编辑</a>&nbsp;&emsp;');
			// 			}
			// 			if(row.taskSupOrg && ('${@UserUtils.getUser().getUserCode()}' == 'system'||row.createBy == '${@UserUtils.getUser().getUserCode()}')){
			// 				actions.push('<a style="cursor:pointer;"  onclick=arrangeTask("'+row.id+'")  title="${text("整理任务")}" ><span class="btn btn-primary btn-xs">整理任务</span></a>&emsp;');
			// 				actions.push('<a href="#" style="cursor:pointer;" onclick=arrangeHis("'+row.id+'")  class="btn btn-primary btn-xs" title="${text("整理历史")}">整理历史</a>&nbsp;&emsp;');
			// 			}
			// 		<% } %>
			// 		return actions.join('');
			// 	}}
		],
		// 加载成功后执行事件
		ajaxSuccess: function(data){

		}
	});

	function showSubTask(id) {
		js.addTabPage(null, "子任务明细","${ctx}/action/dcSupTaskAction/listOrg?taskId="+id , true);
	}

	function editTask(id) {
		js.addTabPage(null, "编辑督办任务","${ctx}/taskdeploy/dcSupTaskInfo/form?id="+id , true);
	}

	function arrangeHis(id) {
		js.addTabPage(null, "整理历史","${ctx}/arrange/dcSupTaskInfoArrange?taskId="+id , true);
	}
	function arrangeTask(taskId){
		js.layer.open({
			type: 2,
			title: ['整理任务'],
			area: ['1000px', '460px'],
			scrollbar: true,
			shadeClose: false,
			content: "${ctx}/taskdeploy/dcSupTaskInfo/arrangeTask?taskId="+taskId,
			btn1: function (index, layero) {
			},
			end:function () {
				$('#dataGrid').dataGrid('refresh', 1, 20);
			}
		});
	}
</script>